//导入Vue包
import Vue from 'vue'
//导入VueRouter包
import VueRouter from 'vue-router'
//导入组件
// import Login from '@/views/Login'
// import Register from '@/views/Register'
// import Home from '@/views/Home'
// import workplace from '@/views/dashboard/workplace.vue'
// import analysis from '@/views/dashboard/analysis.vue'
// import studentList from '@/views/students/studentList.vue'
//将VueRouter作为插件设置到Vue中
Vue.use(VueRouter)
//创建routes数组
const routes=[
    {
        path:'/login',
        component:()=>import('@/views/Login')
    },
    {
        path:'/register',
        component:()=>import('@/views/Register')
    },
    {
        path:'/',
        redirect:'/home'
    },
    {
        path:'/home',
        component:()=>import('@/views/Home'),
        children:[
            {
               path:'workplace',//二级路由的path的前不要带/
               component:()=>import('@/views/dashboard/workplace.vue'),
               meta:{
                firstTitle:'控制面板',
                secondTitle:'工作台',
                iskeepAlive:true
               }
            },
            {
                path:'analysis',
                component:()=>import('@/views/dashboard/analysis.vue'),
                meta:{
                    firstTitle:'控制面板',
                    secondTitle:'统计报表',
                    iskeepAlive:false
                }
            },
            {
                path:'studentList',
                component:()=>import('@/views/students/studentList.vue'),
                meta:{
                    firstTitle:'学生管理',
                    secondTitle:'学生列表'
                }
            },
            {
                name:'xsxq',
                path:'studentDetail',
                component:()=>import('@/views/students/studentDetail.vue'),
                meta:{
                    firstTitle:'学生管理',
                    secondTitle:'学生详情'
                }
            }
        ]
    }
]
const router=new VueRouter({
    routes
})
//将这个路由器对象导出
export default router